<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"><meta name="referrer" content="no-referrer" />
    <title>添加pyq页面</title>
    <script src="js/jquery-1.11.0.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <style>
        .left-side {
            position: fixed;
            top: 0;
            bottom: 0;
            z-index: 5;
            display: block;
            width: 240px;
            font-weight: 500;
        }
        .card{
            display: flex;
            justify-content: center;
            align-items: center;
            height: 700px;
            border-radius: 5px;
        }
        .submenu >ul{
            display: none;
        }
        .open>ul{
            display: block;
        }
    </style>
    <script>
        $(function () {
            console.log("进入头部");
            $(".header").load("headHtml");
            var id = window.sessionStorage.getItem("pyqId");
            $.ajax({
                url:"getPyq",
                type:"POST",
                contentType: "application/json",//划重点
                // async:false,//同步，默认异步
                dataType:"json",
                data: JSON.stringify({"pyqId":id}),//划重点
                success: function (data) {
                    if (data!=null){
                        $a = $("#spiderSea");
                        var li = '';
                        li = li + '<div action="" method="post">\n' +
                            '                                    标题：<input class="inputText" id="noticeName" name="noticeName" value="' + data.description + '" style="width: 350px;height: 20px"><br><br><br>\n' +
                            '                                    图片：<img src="' + data.justImgUrl + '" style="max-width:50%;max-height:50%;width:auto;height:auto;"><br><br><br>\n' +
                            '                                    内容：<input placeholder="请输入内容" class="inputText" id="noticeContent" name="noticeContent" style="width: 350px;height: 40px"><br><br><br>\n' +
                            '                                    日期：<input type="datetime-local" placeholder="请输入日期" id="noticeDate" class="inputText" name="noticeDate" style="width: 350px;height: 20px"><br><br><br>\n' +
                            '                                    <input type="submit" class="start" value="添加" style="height: 30px; float: right;" onclick="addPyq(' + data.id + ')">\n' +
                            '                                </div>';
                        $a.html(li);
                    }
                }
            });
        });
        function addPyq(a){
            var title = $("#noticeName").val();
            var con = $("#noticeContent").val();
            var date = $("#noticeDate").val();
            $.ajax({
                url:"addPyq",
                type:"POST",
                contentType: "application/json",//划重点
                // async:false,//同步，默认异步
                dataType:"json",
                data: JSON.stringify({"title":title,"con":con,"date":date,"id":a}),//划重点
                success: function (data) {
                    if (data===1){
                        confirm("发表成功！");
                    }
                }
            });
        }
    </script>
    <script>
        $(function () {
            $('.submenu').mouseover(function(){
                $(this).addClass('open');
            }).mouseout(function(){
                $(this).removeClass('open');
            });
        })
    </script>
</head>
<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">
            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <h1 style="text-align: center;color: #33cabb;">Spider</h1>
            </div>
            <div class="lyear-layout-sidebar-scroll">
                <nav class="sidebar-main">
                    <ul class="nav nav-drawer" style="list-style: none">
                        <li class="nav-item active"><a href="/notice"><i class="mdi mdi-home"></i>公告栏</a></li>
                        <li class="nav-item active"><a href="/index"><i class="mdi mdi-home"></i>爬取图片</a></li>
                        <li class="nav-item active"><a href="/displayHtml"><i class="mdi mdi-home"></i>我的收藏</a></li>
                        <li class="nav-item active"><a href="/share"><i class="mdi mdi-home"></i>好图分享</a></li>
                        <li class="nav-item active submenu"><a href="#"><i class="mdi mdi-home"></i>个人中心</a>
                            <ul class="nav nav-drawer">
                                <li class="nav-item active"><a href="/self">&nbsp&nbsp&nbsp&nbsp<i class="mdi mdi-step-forward"></i>信息编辑</a></li>
                                <li class="nav-item active"><a href="/record">&nbsp&nbsp&nbsp&nbsp<i class="mdi mdi-step-forward"></i>爬取记录</a></li>
                                <li class="nav-item active"><a href="/comment">&nbsp&nbsp&nbsp&nbsp<i class="mdi mdi-step-forward"></i>评论反馈</a></li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>
        </aside>
        <!--End 左侧导航-->
        <!--头部信息-->
        <div class="header"></div>
        <!--End 头部信息-->
        <!-- 主题内容 -->
        <!--页面主要内容 table table-striped table-hover-->
        <main class="lyear-layout-content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div id="spiderSea">
                                <div action="" method="post">
                                    标题：<input placeholder="请输入标题" class="inputText" id="noticeName" name="noticeName" style="width: 350px;height: 20px"><br><br><br>
                                    内容：<input placeholder="请输入内容" class="inputText" id="noticeContent" name="noticeContent" style="width: 350px;height: 40px"><br><br><br>
                                    日期：<input type="datetime-local" placeholder="请输入日期" id="noticeDate" class="inputText" name="noticeDate" style="width: 350px;height: 20px"><br><br><br>
                                    <input type="submit" class="start" value="添加" style="height: 30px; float: right;" onclick="add()">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
        <!--End 页面主要内容-->
    </div>
</div>
</body>
</html>